const TOKEN_KEY = 'token';

export function setTokenAUTH<T>(token: T) {
  sessionStorage.setItem(TOKEN_KEY, JSON.stringify(token));
}

export function getTokenAUTH<T>(): T | null {
  const value = sessionStorage.getItem(TOKEN_KEY);
  if (value) {
    const result: T = JSON.parse(value);
    return result;
  }
  return null;
}

export function removeTokenAUTH() {
  sessionStorage.removeItem(TOKEN_KEY);
}
